module.exports = [
  // user login
  {
    url: '/user/login',
    type: 'post',
    response: config => {
      const { username, password } = config.body;
      if (username && password) {
        return {
          code: 200,
          data: new Date(),
          msg: '登录成功',
        };
      }

      return {
        code: 400,
        data: null,
        msg: 'Account and password are incorrect.',
      };
    },
  },

  // 获取用户信息
  {
    url: '/user/me',
    type: 'get',
    response: req => {
      const token = req.headers.auth;
      if (token && token.length > 10) {
        return {
          code: 200,
          msg: '操作成功',
          data: {
            // 用户信息结构体
          },
        };
      } else {
        return {
          code: 50008,
          message: '获取用户信息失败',
        };
      }
    },
  },

  // 获取验证码
  {
    url: `/user/sendPhoneCode`,
    type: 'get',
    response: req => {
      const { phone } = req.query;
      if (phone) {
        return {
          code: 200,
          msg: '验证码获取成功',
          data: 111111,
        };
      } else {
        return {
          code: 400,
          msg: '验证码获取失败',
          data: null,
        };
      }
    },
  },

  {
    url: '/user/logout',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success',
      };
    },
  },
];
